<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
 	<jsp:include page="header.jsp"/>
	<h3>
		Request for help
	</h3>

<div class="span8">
<div class="container">  

					
<form:form method="post" action="requestHelp">
	<form:hidden path="helpFrom" />
	<form:label path="startTime" >Start time </form:label>
	<form:input path="startTime" />DD-MM-YY hh:mm<br/>
	<form:label path="endTime" >End time </form:label>
	<form:input path="endTime" /> DD-MM-YY hh:mm<br/>
	<form:label path="description" >Description </form:label>
	<form:textarea path="description" />
	<input type="submit" class="btn btn-primary" value="Request"/>
	
</form:form>

</div> 
<div id="course-div1" >
	
</div>
</div>
</div>


	<jsp:include page="footer.jsp" />
	<script type="text/javascript">
var html = '';
$(document).ready(function () {
	getCourses();
});

function getCourses(categoryId){
	var url = 'courses.json?categoryId='+categoryId;
	
	jQuery.ajax({
		url: url,
		type: 'GET',
		success: function (data){
			var html = '';
			data = eval(data);
			if(data != null && data != 'undefined'){
				data = eval(data);
				for(var i =0 ; i < data.length ;i++){
					if(i%3==0){
						if(i != 0){
							html = html + '</div><div class="row">';
						}else{
							html = html + '<div class="row">';
						}
					}
					html = html + '<div class="span2"><h2>'+data[i].name+'</h2><p>'+data[i].description+'.</p><p><a class="btn" href="course/'+data[i].id+'">ViewDetails &raquo;</a></p></div>';
				}
				html = html + '</div>';
			}
			console.log(html);
			document.getElementById('course-div1').innerHTML = html;
			//${'#course-div'}.html(html);
		}
	});		

}
</script>
	
</html> 

